home *** CD-ROM | disk | FTP | other *** search
/ Power CD / Power CD ATARI-Rechner Lieben.iso / APPS / PD / EULER / PROGS / JULIA.E < prev    next >
Encoding:
Text File  |  1991-12-22  |  1.0 KB  |  48 lines

  1. .. Show the apple set and investigate it, starts automatically or with
  2.  
  3. function apple1 (z)
  4. ## one iteration
  5.     w=1i+z*z;
  6.     return w
  7. endfunction
  8.  
  9. function apple (z)
  10. ## compute 10 iterations
  11.     w=z;
  12.     loop 1 to 10; w=apple1(w); end:
  13.     return w
  14. endfunction
  15.  
  16. function showapple (a)
  17. ## show the apple set in 3D
  18.     {x,y}=field(linspace(a[1],a[2],50),linspace(a[3],a[4],50));
  19.     z=x+1i*y; w=apple(z);
  20.     view(5,3,-0.75,0.7); twosides(0);
  21.     wa=abs(w); wa=max(wa,1);
  22.     l=log(wa); l=2*l/max(max(l)');
  23.     framedsolid(x,y,-l,1);
  24.     return wa;
  25. endfunction
  26.  
  27. x=[-2,2,-2,2];
  28. w=showapple(x); title("Bitte Taste drücken!"); wait(180);
  29.  
  30. function test(w)
  31. ## show the iterations
  32.     global x;
  33.     setplot(x);
  34.     shrinkwindow(); xplot(); hold on; wl=log(w);
  35.     contour(wl,linspace(1,max(max(wl)'),10));
  36.     title("Klicken Sie einen Punkt an! (Ende -> <Hier>)");
  37.     r=0;
  38.     repeat;
  39.         m=mouse(); z=m[1]+1i*m[2];
  40.         if m[2]>x[4]; break; endif;
  41.         {r,R}=iterate("apple1",z,20);
  42.         color(2); plot(re(R),im(R)); color(1);
  43.     end;
  44.     hold off;
  45.     return r
  46. endfunction
  47.  
  48. test(w);